package sui.core
{
    import sui.reflect.Metadata;

    public class SkinnableComponent extends ComponentBase
    {
        sui_internal var skin:*;

        protected function get skin():*
        {
            return sui_internal::skin;
        }

        public function SkinnableComponent(skin:*)
        {
            if (skin != null && skin is Class)
            {
                skin = new skin;
            }
            sui_internal::skin = skin;
        }

        sui_internal function setVariableSkin(name:String, //
                                              skin:*, //
                                              metadata:Metadata):void
        {
            this[name] = skin;
            if (skin is SkinnableComponent)
            {
                SkinnableComponent(skin).setMetadata(metadata);
            }
        }

        protected function setMetadata(metadata:Metadata):void
        {
        }
    }
}
